#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int mod = 1e9+7;
const int N = 50010;
const int M = 1e6+10;

ll f[M],g[M];
int n,a[N],A;
bool vis[M];

ll qp(ll x,int t){ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

void getg(){
	f[1] = 1;for(int i = 2;i <= A;i++) f[i] = (f[i-1] + f[i-2]) % mod;
	for(int i = 1;i <= A;i++) g[i] = f[i];
	for(int i = 1;i <= A;i++){
		ll inv = qp(g[i],mod-2);
		for(int j = i+i;j <= A;j += i) g[j] = g[j] * inv % mod;
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = in,A = max(a[i],A),vis[a[i]] = 1;
	getg(); ll ans = 1;
	for(int i = 1;i <= A;i++){
		bool app = 0;
		for(int j = i;j <= A;j+=i) if(vis[j]) {app = 1;break;}
		if(app) ans = ans * g[i] % mod;
	}
	printf("%lld\n",ans);
	return 0;
}

